package com.jfm.jfmm.collector.driver;

import com.jfm.jfmm.collector.entity.collect.CollectParam;
import com.jfm.jfmm.collector.entity.collect.Param;
import com.jfm.jfmm.collector.entity.collect.Result;
import com.jfm.jfmm.collector.entity.collect.param.HTTPParam;
import com.jfm.jfmm.collector.entity.collect.result.HTTPResult;
import com.jfm.jfmm.collector.entity.device.Device;
import com.jfm.jfmm.collector.entity.template.CollectTemplate;
import com.jfm.jfmm.collector.enums.CollectorProtocol;

import java.util.List;

/**
 * @author DYang
 * @since 2024-10-08 23:18
 * HTTP 协议采集驱动
 */
public abstract class HTTPDriver implements ACollectorDriver<HTTPParam, HTTPResult>{

    @Override
    public boolean isAvailable(Param param) {
        return true;
    }

    @Override
    public HTTPParam transformParam(Param reqParam) {
        if (reqParam instanceof HTTPParam) {
            return (HTTPParam) reqParam;
        }
        return null;
    }

    @Override
    public HTTPResult transformResult(Result result) {
        if (result instanceof HTTPResult) {
            return (HTTPResult) result;
        }
        return null;
    }

    @Override
    public CollectorProtocol supportProtocol() {
        return CollectorProtocol.HTTP;
    }

    @Override
    public List<CollectParam> buildCollectParam(Device device, CollectTemplate template) {
        return null;
    }
}
